package com.geeguo.ebuilder.client.business.system.organization.model;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

@Getter
@Setter
public class OrganizationVO {

    @Schema(title = "主键")
    private String     id;
    @Schema(title = "父级Id")
    private String     parentId;
    @Schema(title = "编码")
    private String     code;
    @Schema(title = "名称")
    private String     name;
    @Schema(title = "层级")
    private Integer    depth;
    @Schema(title = "顺序")
    private Integer    sequence;
    @Schema(title = "启用状态（1：启用、2：停用）")
    private Integer    state;

    @Schema(title = "子集")
    private List<OrganizationVO> children;

    public void addChild(OrganizationVO child) {
        if (children == null) {
            children = new ArrayList<>();
        }
        children.add(child);
    }
}